Skip to content

feat: strong equality matcher #1733

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 8, 2023
Merged

feat: strong equality matcher #1733

merged 7 commits into from
Feb 8, 2023

Conversation

csviri
Copy link
Collaborator

@csviri csviri commented Jan 25, 2023

No description provided.

@csviri csviri self-assigned this Jan 25, 2023
@csviri csviri requested a review from metacosm January 25, 2023 15:33
@@ -61,6 +66,9 @@ public static <R extends HasMetadata> Result<R> match(R desired, R actualResourc
var desiredSpecNode = objectMapper.valueToTree(ReconcilerUtils.getSpec(desired));
var actualSpecNode = objectMapper.valueToTree(ReconcilerUtils.getSpec(actualResource));
var diffJsonPatch = JsonDiff.asJson(desiredSpecNode, actualSpecNode);
if (strongEquality && diffJsonPatch.size() > 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment as to why this determines that things are not equal according to "strong equality" would be helpful. For that matter, defining what strong equality is would be helpful! 😄

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed to equality, added detailed javadoc

@csviri csviri requested a review from metacosm January 26, 2023 10:31
@@ -61,6 +90,9 @@ public static <R extends HasMetadata> Result<R> match(R desired, R actualResourc
var desiredSpecNode = objectMapper.valueToTree(ReconcilerUtils.getSpec(desired));
var actualSpecNode = objectMapper.valueToTree(ReconcilerUtils.getSpec(actualResource));
var diffJsonPatch = JsonDiff.asJson(desiredSpecNode, actualSpecNode);
if (equality && diffJsonPatch.size() > 0) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still would like a comment here to explain why this makes a difference

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added comment

@csviri csviri requested a review from metacosm February 8, 2023 08:41
@csviri csviri merged commit 34b559e into main Feb 8, 2023
@csviri csviri deleted the strong-equality-matcher branch February 8, 2023 09:21
@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 8, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

81.8% 81.8% Coverage
0.0% 0.0% Duplication

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error in GenericKubernetesResourceMatcher when reconciling resources with no spec
2 participants